#ifndef DRMFILE_H
#define DRMFILE_H

#include <QObject>

class DRMFilePrivate;

/*
 * DRMFile class
 *
 * Utility API intended to demonstrate and facilitate access to DRM protected
 * content.
 *
 * The API has two private implementations, one Symbian specific - using the
 * Content Access Framework (CAF) API - and an empty one which enables the API
 * to be used (more like compiled) in the simulator
 */
class DRMFile : public QObject
{
    Q_OBJECT
    Q_DECLARE_PRIVATE(DRMFile)

public:
    /*
     * Constructor
     */
    explicit DRMFile(QObject *parent = 0);
    /*
     * Destructor
     */
    virtual ~DRMFile();

public:

    /*
     * Read only open method for the specified file
     *
     * const QString & name - fully cualified file name and path.
     *
     * Will return a negative error code if the file opening fails. The error
     * code should be checked with *isDRMError* in order to understand
     */
    int open(const QString & name);

    /*
     * Read max of *length* bytes into the provided *data* buffer
     *
     * Will return a negative error code or the length of the read data.
     */
    int read(char* data, int length);

    /*
     * Close the file.
     */
    void close();

    /*
     * Returns a 32b value size of the amount of available (uncompressed) data.
     */
    int size();

#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API

    /*
     * Returns a 64b value size of the amount of available (uncompressed) data.
     * Only supported starting with Symbian^3
     */
    qint64 size64();
#endif

    /*
     * Returns true if the error code returned by the *open* method is a DRM
     * specific error
     */
    bool isDRMError(int error);

protected:
    /*
     * Private implementation of the API
     */
    DRMFilePrivate* const d_ptr;
};

#endif // DRMFILE_H
